package cn.kgc.util;

public class PageUtil {
    //每页显示的条数
    private Integer pageSize;
    //当前页
    private Integer currentNo;
    //总页数
    private Integer total;
    //总条数
    private Integer count;


    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getCurrentNo() {
        return currentNo;
    }
    //判断当前页的值
    public void setCurrentNo(Integer currentNo) {
        if(currentNo<=1){
            this.currentNo=1;
        }else if (currentNo>=total){
            this.currentNo=this.total;
        }else{
            this.currentNo=currentNo;
        }
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer count) {
        this.total=count%pageSize==0?count/pageSize:count/pageSize+1;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }
}
